#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<int> arr(13, 0);
    for (int i = 1; i < 13; i++)
    {
        cin >> arr[i];
    }

    int money = 300;
    int sum = 0;
    int ret = 0;
    for (int i = 1; i < 13; i++)
    {
        if ((sum += (money - arr[i])) >= 0)
        {
            if (sum >= 100)
            {
                ret += (sum / 100) * 100;
                sum -= (sum / 100) * 100;
            }
        }
        else
        {

            cout << -i << endl;
            return 0;
        }
    }

    int tmp = ret * 1.2 + sum;
    cout << tmp << endl;

    return 0;
}